<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<select id="sel">
			<option value ="none" id="none">选择下注</option>
			<option value ="big" id="big">大</option>
			<option value ="small" id="small">小</option>
			
		</select>
		<div id="">
			<img src="img/1.jpg" id="img1">
		</div>
		<button id="btn" type="button" onclick="start(event)">开始</button>
	</body>
	<script type="text/javascript">
		
		function start(event){
			
			var opv=document.getElementById('sel')
			if(sel.value=='none'){
				alert('未选择赌注')
			   return
			}
			var a=document.getElementById('btn')
			event.target.innerText='正在抽奖'
			document.getElementById('btn').disable=true
			
			var setin=setInterval(function(){
				var k=rand()
				document.getElementById('img1').src='img/'+k+'.jpg'
				var time=0
				time++	
				if(time>20){
					clearInterval(setin)
					event.target.innerText='重新抽奖'
					document.getElementById('btn').disable=false
					switch(sel.value){
						case 'big':
						if(k>3){
							alert('中了')
						}else{
							alert('错了')
						}
						break
						case 'small':
						if(k<4){
							alert('对了')
						}else{
							alert('错了')
						}
					}
				}
				
			},50)
			
			
			
			
			
			
			
		}
		function rand(){
			while(true){
				var r=Math.floor(Math.random()*7)
				if(r!=0){
					return
				}
			}
			
		}
		
	</script>
	
	
	
	
	   
</html>
